/**
 * Created by jianglinjie on Mon Oct 09 2017
 * @flow
 */
'use strict';
import type Storage from 'react-native-storage';

class ConfigService {
  _apiBaseHost: string = '';
  _storage: Storage;

  get apiBaseHost(): string {
    return this._apiBaseHost;
  }

  //外部需要设置apiBase
  set apiBaseHost(host: string): void {
    if (host.length && host.slice(host.length - 1) === '/') {
      host = host.slice(0, host.length - 1);
    }
    
    this._apiBaseHost = host;
  }

  //外部需要设置
  get storage(): Storage {
    return this._storage;
  }

  set storage(s: Storage): void {
    this._storage = s;
  }
}

export default new ConfigService();
